
var JSonDtoModel = function(){
    this.state = 0;
    this.info = "成功";
    this.route = "";
    this.token = "";
    this.description="";
    this.params = new Map();
    this.setState=function(state){
        this.state = state;
    };

    //set
    this.setInfo=function(info){
        this.info = info;
    };

    this.setRoute=function(route){
        this.route = route;
    };
    this.setToken=function(token){
        this.token = token;
    };
    this.setDescription=function(description){
        this.description = description;
    };
    // get

    this.getState=function(){
        return this.state;
    };

    this.getInfo=function(){
        return this.info;
    };

    this.getRoute=function(){
        return this.route;
    };
    this.getToken=function(){
        return this.token;
    };

    this.getDescription=function(){
        return this.description ;
    };
    this.put=function(key,value){
        this.params.put(key,value);
    };

    this.setParams=function(obj){
        this.params = new Map(obj);
    };

    this.get=function(key){
        return this.params.get(key);
    };
    this.toJSONString=function(){
        var res = {};
        res["state"]=this.state;
        res["info"]=this.info;
        res["route"]=this.route;
        res["token"]=this.token;
        res["params"]=this.params.values();


        return JSON.stringify(res);
    };
    this.toString=function(){
        return this.toJSONString();
    };
};

JSonDtoModel.restore = function(str){
    var obj = JSON.parse(str);
    var dto = new JSonDtoModel();
    dto.setState(obj['state']);
    dto.setInfo(obj['info']);
    dto.setRoute(obj['route']);
    dto.setToken(obj['token']);
    dto.setDescription(obj['description']);
    dto.setParams(obj['params']);

    return dto;
};
